package com.bangdream.michelia.model;

import com.alibaba.fastjson.JSON;
import com.bangdream.michelia.application.AppCurrentUser;
import com.bangdream.michelia.contract.CoursesContract;
import com.bangdream.michelia.contract.RecommendContract;
import com.bangdream.michelia.tool.retrofithttp.RetroFactory;
import com.bangdream.michelia.utils.L;

import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MediaType;
import okhttp3.RequestBody;

/**
 * @date on 2018/8/1 20:55
 * @email 909732184@qq.com
 * 头部推荐信息
 */
public class IRecommendModelImpl implements RecommendContract.IRecommendModel{
    @Override
    public Observable getRecommendList(Map<Object, Object> paramsMap) {
        String jsonString = JSON.toJSONString(paramsMap);
        L.d(jsonString);
        RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"),jsonString);
        return RetroFactory.getInstance().getRecommendList(AppCurrentUser.getInstance().getToken(),
                body);
    }
}
